From: Florian Müllner Date: Thu, 29 Nov 2012 15:09:21 +0000 (+0100) Subject: extensionSystem: Add support for mode-specific extensions X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5305 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=31f75e46073d58a978415027571b3705e3972109;p=gnome-shell.git extensionSystem: Add support for mode-specific extensions As currently envisioned, the fallback replacement in 3.8 should be a separate session at the login screen. As we will use extensions to implement this mode, we need a way to specify extensions per session rather than per user, so add a session-mode property for extensions that should be loaded in addition to the user-defined ones. https://bugzilla.gnome.org/show_bug.cgi?id=689305 --- diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index 62775a3b7..7ec96bc4d 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -211,8 +211,16 @@ function initExtension(uuid) { _signals.emit('extension-loaded', uuid); } +function getEnabledExtensions() { + let extensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY); + if (!Array.isArray(Main.sessionMode.enabledExtensions)) + return extensions; + + return Main.sessionMode.enabledExtensions.concat(extensions); +} + function onEnabledExtensionsChanged() { - let newEnabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY); + let newEnabledExtensions = getEnabledExtensions(); if (!enabled) return; @@ -246,7 +254,7 @@ function onEnabledExtensionsChanged() { function _loadExtensions() { global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged); - enabledExtensions = global.settings.get_strv(ENABLED_EXTENSIONS_KEY); + enabledExtensions = getEnabledExtensions(); let finder = new ExtensionUtils.ExtensionFinder(); finder.connect('extension-found', function(signals, extension) { @@ -288,10 +296,17 @@ function disableAllExtensions() { } function _sessionUpdated() { - if (Main.sessionMode.allowExtensions) + // For now sessionMode.allowExtensions controls extensions from both the + // 'enabled-extensions' preference and the sessionMode.enabledExtensions + // property; it might make sense to make enabledExtensions independent + // from allowExtensions in the future + if (Main.sessionMode.allowExtensions) { + if (initted) + onEnabledExtensionsChanged(); enableAllExtensions(); - else + } else { disableAllExtensions(); + } } function init() { diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js index eacefd094..25a5efa95 100644 --- a/js/ui/sessionMode.js +++ b/js/ui/sessionMode.js @@ -18,6 +18,7 @@ const _modes = { showCalendarEvents: false, allowSettings: false, allowExtensions: false, + enabledExtensions: [], hasRunDialog: false, hasWorkspaces: false, hasWindows: false,